JavaScript

A5.editinsert Method

Syntax

A5.edit.insert(element,value[,start[,end]])

Arguments

elementelement

The INPUT or TEXTAREA element to insert the value into.

valuestring

The value to insert.

startnumberstring

Optionally set the selection start for inserting. If no value is passed in then the current selection is used. See A5.edit.setSelection.

endnumber

Optionally set the selection end for inserting. See A5.edit.setSelection.

Description

Insert a value into an edit control (INPUT or TEXTAREA).

Discussion

The A5.edit.insert method allows for the inserting of a text value into an INPUT or TEXTAREA. The insert method will honor the undo stack, meaning that the user can undo changes done by the insert.

Example

// assume that "ele" is a DOM element pointer to an TEXTAREA control, and that the value of the TEXTAREA is "Hello |,\nYour message was received!" - the "|" represents the cursor location.
A5.edit.insert(ele,'{firstname}');
// the value of the TEXTAREA would now be "Hello {firstname}|,\nYour message was received!"